class Square:

    def __init__(self, count: int):
        self.count = count
        self.current = 0

    def __iter__(self):
        return self

    def __next__(self):
        result = self.current ** 2
        self.current += 1

        if self.current >= self.count:
            raise StopIteration

        return result


s = Square(10)

# for i in s:
#     print(i)


def square(count: int):
    for n in range(count):
        yield n ** 2

for i in square(10):
    print(i)
